-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix socketlen change related issues #97046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
zsock_recvfrom() takes as last argument a socklen_t pointer which type was changed in c546c1c as is not anymore equivalent to size_t. So let's ensure we pass the right type of pointer to it. Signed-off-by: Alberto Escolar Piedras <[email protected]>
net_tcp_accept_cb_t takes a socklen_t as 3rd argument, which type was changed in c546c1c and is not anymore equivalent to size_t. So let's correct it. As a freebie, let's define that function as static as it is. Signed-off-by: Alberto Escolar Piedras <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I wonder why these were not found out as part of the original PR.
zsock_getsockopt() takes as last argument a socklen_t pointer which type was changed in c546c1c as is not anymore equivalent to size_t. So let's ensure we pass the right type of pointer to it. Signed-off-by: Alberto Escolar Piedras <[email protected]>
Zephyr's socklen_t was changed in c546c1c to be uint32_t instea of size_t. Let's fix accordingly the prototypes which expect it. Signed-off-by: Alberto Escolar Piedras <[email protected]>
zsock_recvfrom() takes as last argument a socklen_t pointer ( c546c1c ) whose definition has changed. So let's ensure we pass the right type of pointer to it. Signed-off-by: Alberto Escolar Piedras <[email protected]>
69cd94a
to
4576591
Compare
Two more fixes after running a full twister run on native_sim//64 locally.
PRs run only a subset of tests, and unfortunately issues get past sometimes :( |
|
void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr, | ||
size_t len, int val, void *data) | ||
static void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr, | ||
socklen_t len, int val, void *data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t
is sufficient to represent any socket length, so rather than mixing up POSIX in drivers, I would suggest sticking to fixed-width integer types. That also mirrors what is done in the network subsystem.
socklen_t len, int val, void *data) | |
uint32_t len, int val, void *data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is used as a callback of type net_tcp_accept_cb_t. This is just the signature of that type.
I agree that using socklen_t in drivers is not nice, but to change that we'd need to change that callback type and all other users.
But this PR is just an immediate fix for the CI issue.
struct net_buf *dns_data = NULL; | ||
struct sockaddr addr; | ||
size_t addrlen; | ||
socklen_t addrlen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
socklen_t addrlen; | |
uint32_t addrlen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the pointer type zsock_recvfrom() expects.
Note socklen_t is already used in this same function.
Zephyr's socklen_t was changed in
c546c1c
to be uint32_t instea of size_t.
Let's fix accordingly the prototypes which expect it.
Related to: